import fp from 'fastify-plugin';
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient({
    omit: {
        user: {
            password: true
        }
    }
});

declare module 'fastify' {
    interface FastifyInstance {
        prisma: typeof prisma;
    }
}

export default fp(function (fastify, opts, done) {
    fastify.decorate('prisma', prisma);

    done();
});